<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		
		<meta charset="utf-8" />
		<title></title>
		
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link href="css/bootstrap.min.css" rel="stylesheet" />
		<link href="css/bootstrap-responsive.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/font-awesome.min.css" />
		<!--[if IE 7]><link rel="stylesheet" href="css/font-awesome-ie7.min.css" /><![endif]-->
		<!--[if lt IE 9]><link rel="stylesheet" href="css/ace-ie.min.css" /><![endif]-->
		<!-- 下拉框 -->
		<link rel="stylesheet" href="css/chosen.css" />
		
		<link rel="stylesheet" href="css/ace.min.css" />
		<link rel="stylesheet" href="css/ace-responsive.min.css" />
		<link rel="stylesheet" href="css/ace-skins.min.css" />
		
		<link rel="stylesheet" href="css/datepicker.css" /><!-- 日期框 -->
		<script type="text/javascript" src="js/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="js/jquery.tips.js"></script>
		
<script type="text/javascript">
	
	
	
	//保存
	function save(){
			if($("#ANCHORID").val()==""){
			$("#ANCHORID").tips({
				side:3,
	            msg:'请输入主播id',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#ANCHORID").focus();
			return false;
		}
		if($("#USERNAME").val()==""){
			$("#USERNAME").tips({
				side:3,
	            msg:'请输入用户名',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#USERNAME").focus();
			return false;
		}
		if($("#PASSWORD").val()!=$("#pwdchk").val()){
			
			$("#pwdchk").tips({
				side:3,
	            msg:'两次密码不相同',
	            bg:'#AE81FF',
	            time:3
	        });
			
			$("#pwdchk").focus();
			return false;
		}
		if($("#REALNAME").val()==""){
			$("#REALNAME").tips({
				side:3,
	            msg:'请输入真实姓名',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#REALNAME").focus();
			return false;
		}
		if($("#PORTRAIT").val()==""){
			$("#PORTRAIT").tips({
				side:3,
	            msg:'请输入头像',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#PORTRAIT").focus();
			return false;
		}
		if($("#AGE").val()==""){
			$("#AGE").tips({
				side:3,
	            msg:'请输入年龄',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#AGE").focus();
			return false;
		}
		if($("#PROFESSION ").val()==""){
			$("#PROFESSION ").tips({
				side:3,
	            msg:'请输入职业',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#PROFESSION ").focus();
			return false;
		}
		if($("#IDCARD").val()==""){
			$("#IDCARD").tips({
				side:3,
	            msg:'请输入身份证',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#IDCARD").focus();
			return false;
		}
		if($("#MAIL").val()==""){
			$("#MAIL").tips({
				side:3,
	            msg:'请输入邮箱',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#MAIL").focus();
			return false;
		}
		if($("#TELEPHONE").val()==""){
			$("#TELEPHONE").tips({
				side:3,
	            msg:'请输入电话',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#TELEPHONE").focus();
			return false;
		}
		if($("#APPROVETIME").val()==""){
			$("#APPROVETIME").tips({
				side:3,
	            msg:'请输入认证时间',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#APPROVETIME").focus();
			return false;
		}
		if($("#DEALWITH").val()==""){
			$("#DEALWITH").tips({
				side:3,
	            msg:'请输入处理人',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#DEALWITH").focus();
			return false;
		}
		$("#Form").submit();
		$("#zhongxin").hide();
		$("#zhongxin2").show();
	}
	
</script>
	</head>
<body>
	<div class="span6">
		<div class="widget-box transparent">
			<div class="widget">
				<div class="widget-toolbar no-border">
					<ul class="nav nav-tabs" id="recent-tab">
						<li class="active"><a data-toggle="tab" href="#task-tab">信息</a></li>
						<li><a data-toggle="tab" href="#member-tab">权限</a></li>
					</ul>
				</div>
			</div>

			<div class="widget-body">
				<div class="widget-main padding-5">
					<form action="anchor/${msg }.do" name="Form" id="Form" method="post">
					<div id="zhongxin">
						<div class="tab-content padding-8">
							<div id="task-tab" class="tab-pane active">
								<input type="hidden" name="ANCHOR_ID" id="ANCHOR_ID" value="${pd.ANCHOR_ID}"/>
								<table>
									<tr>
										<td><input type="text" name="ANCHORID" id="ANCHORID" value="${pd.ANCHORID}" maxlength="32" placeholder="这里输入主播id" title="主播id"/></td>
										<td><input type="text" name="USERNAME" id="USERNAME" value="${pd.USERNAME}" maxlength="32" placeholder="这里输入用户名" title="用户名"/></td>
									</tr>
									<tr>
										<td><input type="password" name="PASSWORD" id="PASSWORD" maxlength="32" placeholder="这里输入密码" title="密码"/></td>
										<td><input type="password" name="pwdchk" id="pwdchk" maxlength="32" placeholder="这里输入密码" title="密码"/></td>
									</tr>
									<tr>
										<td><input type="text" name="REALNAME" id="REALNAME" value="${pd.REALNAME}" maxlength="32" placeholder="这里输入真实姓名" title="真实姓名"/></td>
										<td><input type="text" name="PORTRAIT" id="PORTRAIT" value="${pd.PORTRAIT}" maxlength="32" placeholder="这里输入头像" title="头像"/></td>
									</tr>
									<tr>
										<td><input type="number" name="AGE" id="AGE" value="${pd.AGE}" maxlength="32" placeholder="这里输入年龄" title="年龄"/></td>
										<td><input type="text" name="PROFESSION " id="PROFESSION " value="${pd.PROFESSION }" maxlength="32" placeholder="这里输入职业" title="职业"/></td>
									</tr>
									<tr>
										<td><input type="text" name="IDCARD" id="IDCARD" value="${pd.IDCARD}" maxlength="32" placeholder="这里输入身份证" title="身份证"/></td>
										<td><input type="text" name="MAIL" id="MAIL" value="${pd.MAIL}" maxlength="32" placeholder="这里输入邮箱" title="邮箱"/></td>
									</tr>
									<tr>
										<td><input type="text" name="TELEPHONE" id="TELEPHONE" value="${pd.TELEPHONE}" maxlength="32" placeholder="这里输入电话" title="电话"/></td>
										<td><input type="text" name="APPROVETIME" id="APPROVETIME" value="${pd.APPROVETIME}" maxlength="32" placeholder="这里输入认证时间" title="认证时间"/></td>
									</tr>
									<tr>
										<td><input type="text" name="DEALWITH" id="DEALWITH" value="${pd.DEALWITH}" maxlength="32" placeholder="这里输入处理人" title="处理人"/></td>
									</tr>
									<tr>
										<td colspan="2" style="text-align: center;">
											<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
											<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
										</td>
									</tr>
								</table>
							</div>

							<div id="member-tab" class="tab-pane">
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">用户身份权限:</small> 
											<c:choose>
												<c:when test="${pd.IDENTITYSIGN==1}">
													<input name="IDENTITYSIGN" value="${pd.IDENTITYSIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="IDENTITYSIGN" value="${pd.IDENTITYSIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span>
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">是否停用:</small>
											<c:choose>
												<c:when test="${pd.DELETESIGN==1}">
													<input name="DELETESIGN" value="${pd.DELETESIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="DELETESIGN" value="${pd.DELETESIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> <span class="lbl"></span>
									</label>
								</span> 
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">登陆权限:</small> 
											<c:choose>
												<c:when test="${pd.LOGINSIGN==1}">
													<input name="LOGINSIGN" value="${pd.LOGINSIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="LOGINSIGN" value="${pd.LOGINSIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span> 
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">进入直播间:</small> 
											<c:choose>
												<c:when test="${pd.INTOSIGN==1}">
													<input name="INTOSIGN" value="${pd.INTOSIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="INTOSIGN" value="${pd.INTOSIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span> 
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">作品评论:</small> 
											<c:choose>
												<c:when test="${pd.COMMENTSIGN==1}">
													<input name="COMMENTSIGN" value="${pd.COMMENTSIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="COMMENTSIGN" value="${pd.COMMENTSIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span>
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">发布任务:</small> 
											<c:choose>
												<c:when test="${pd.MISSIONSIGN==1}">
													<input name="MISSIONSIGN" value="${pd.MISSIONSIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="MISSIONSIGN" value="${pd.MISSIONSIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span>
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">开启直播间:</small> 
											<c:choose>
												<c:when test="${pd.OPENINTOSIGN==1}">
													<input name="OPENINTOSIGN" value="${pd.OPENINTOSIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="OPENINTOSIGN" value="${pd.OPENINTOSIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span>
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">上传作品:</small> 
											<c:choose>
												<c:when test="${pd.UPLOADSIGN==1}">
													<input name="UPLOADSIGN" value="${pd.UPLOADSIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="UPLOADSIGN" value="${pd.UPLOADSIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span>
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">提现限制:</small> 
											<c:choose>
												<c:when test="${pd.CASH==1}">
													<input name="CASH" value="${pd.CASH}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="CASH" value="${pd.CASH}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span>
								<span class="span5"> 
									<label class="pull inline">
											<small class="muted">接任务权限限制:</small> 
											<c:choose>
												<c:when test="${pd.TASKSIGN==1}">
													<input name="TASKSIGN" value="${pd.TASKSIGN}" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:when>
												<c:otherwise>
													<input name="TASKSIGN" value="${pd.TASKSIGN}" checked="checked" type="checkbox" class="ace ace-switch ace-switch-5" />
												</c:otherwise>
											</c:choose> 
											<span class="lbl"></span>
									</label>
								</span>
							</div>
							<!-- member-tab -->
						</div>
						</div>
						<div id="zhongxin2" class="center" style="display:none"><br/><br/><br/><br/><br/><img src="images/jiazai.gif" /><br/><h4 class="lighter block green">提交中...</h4></div>
					</form>
				</div>
				<!--/widget-main-->
			</div>
			<!--/widget-body-->

		</div>
		<!--/widget-box-->
	</div>
	<!-- 引入 -->
	<script type="text/javascript">window.jQuery || document.write("<script src='js/jquery-1.9.1.min.js'>\x3C/script>");</script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/ace-elements.min.js"></script>
	<script src="js/ace.min.js"></script>
	<script type="text/javascript" src="js/chosen.jquery.min.js"></script><!-- 下拉框 -->
	<script type="text/javascript" src="js/bootstrap-datepicker.min.js"></script><!-- 日期框 -->
	<script type="text/javascript">
	$(window.parent.hangge());
	$(function() {
		
		//单选框
		$(".chzn-select").chosen(); 
		$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
		
		//日期框
		$('.date-picker').datepicker();
		
		//初始化编辑框
		if('${msg }' == "save" ){
			$("#member-tab").hide();
			$("li a[href='#member-tab']").hide();
		}
		
		//权限按钮点击
		$("input[type='checkbox']").click(function() {
			var str = $("#Form").serializeArray();
			
			var arr = ['DELETESIGN','LOGINSIGN','INTOSIGN','COMMENTSIGN','MISSIONSIGN','OPENINTOSIGN','UPLOADSIGN','CASH','TASKSIGN','IDENTITYSIGN'];
			for(var i=0;i<arr.length;i++){
				if($("input[name='"+arr[i]+"']").attr("checked") == "checked"){
					$("input[name='"+arr[i]+"']").val("0");
				}
			}
			
			var data = "";
			var j = 0;
			while (typeof (str[j]) != "undefined") {
				data = str[j].name + "=" + str[j].value + "&" + data;
				j++;
			}
			data = "?" + data.substring(0,data.length-1);
			$.ajax({
				type : "POST",
				url : "/THDLOAN/anchor/edit.do"+data,
				dataType : "json",
				success : function(data) {

				}
			});
		});
	});
	
	</script>
</body>
</html>